package soar.template.springboot.service.hello.configuration.rmi;

import javax.annotation.Resource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiServiceExporter;

import soar.template.springboot.service.rmi.hello.Hello;
import soar.template.springboot.service.hello.appconfig.AppConfig;

@Configuration
class MyRmiServiceConfiguration
{
    @Resource
    private Hello hello;

    @Resource(name = "appconfig")
    private AppConfig appconfig;

    @Bean
    public RmiServiceExporter helloService()
    {
        RmiServiceExporter service = new RmiServiceExporter();
        service.setServiceName("Hello");
        service.setService(hello);
        service.setServiceInterface(Hello.class);
        service.setRegistryPort(appconfig.rmi.port);
        return service;
    }
}
